<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <style>
        * {
            padding: 0px;
            margin: 0px;
        }
        .wrap {
            width: 100%;
            height: 2000px;
            background: rgb(242, 250, 131);
        }
        .box1 {
           width: 80%;
           height: 100px;
           background-color: rgb(231, 38, 38);
           margin: 0 auto;
        }
        .box2 {
           width: 200px;    
           height: 470px;
           background-color: rgb(39, 222, 222);
           margin: 0 auto;
        }
        .sticky{
            position: sticky;
            top: 0px;
        }
    </style>
    </head>
    <body>
        <div class="wrap">
            <div class="box1"></div>
            <div class="box2 sticky"></div>
            <div class="box1"></div>
        </div>
    </body>
</html>